package com.zlf.demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zlf.demo.mapper.UserMapper;
import com.zlf.demo.model.User;
import com.zlf.demo.response.SelectUsersInfoResponseVo;
import com.zlf.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 用户信息表 服务实现类
 * </p>
 *
 * @author zhanglongfei
 * @since 2021-01-15
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    private UserMapper userMapper;

    /**
     * @Description 查询用户角色信息
     * @param:
     * @return:
     * @author:张龙飞
     * @date:2021/1/15 16:01
     */
    public List<SelectUsersInfoResponseVo> listUserAndRoles() {
        return userMapper.selectUserAndRoles();
    }

    /**
     * @Description 根据id查询用户信息
     * @param:
     * @return:
     * @author:张龙飞
     * @date:2021/1/15 16:01
     */
    public List<SelectUsersInfoResponseVo> listUsersByIds() {
        ArrayList<Integer> ids = new ArrayList<Integer>();
        ids.add(1);
        return userMapper.listUsersByIds(ids);
    }
}
